//
//  ShipinViewController.m
//  Products_B
//
//  Created by lanou on 16/6/3.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "ShipinViewController.h"
#import "TopSecondModel.h"

#define kTopSecondURL @"http://api.izhangchu.com/"
@interface ShipinViewController ()
@end

@implementation ShipinViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

}

// 重写父类的网络请求方法
- (void)requestData {
    // 不用继承（super）
    
    NSDictionary *parDic = @{@"methodName":@"MallSpecial",@"version":@4.3,@"id":@12,@"user_id":@1513438,@"_time":@1464934625,@"_signature":@"2248415fe0acfde2e70b153f1db460fb"};
//    NSDictionary *parDic = @{@"methodName":@"MallSpecialList",@"version":@4.3,@"special_id":@14,@"page":@1,@"size":@10,@"user_id":@1513438,@"_time":@1464930742,@"_signature":@"f35d3604e6877e1ac14face1ecdc054b"};
    [RequestManager requestWithUrl:kTopSecondURL requestType:RequestTypePOST parDic:parDic finish:^(NSData *data) {
        NSDictionary *jsonDic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
        NSLog(@" ************ %@",jsonDic);
        // 这里共用了同一个shopModel
        _modelArray = [TopSecondModel topSecondModelAnalyseDataWithJsonDic:jsonDic];
        
        _introString = jsonDic[@"data"][@"specialIntro"];
        _contentString = jsonDic[@"data"][@"specialDesc"];
        self.navigationItem.title = jsonDic[@"data"][@"specialTitle"];
        // 设置导航栏字体大小
        [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:16] forKey:NSFontAttributeName]];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            [_collectionView reloadData];
        });
    } error:^(NSError *error) {
        NSLog(@"请求数据失败");
    }];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
